package cn.ilikes.modules.likes.dbs;

import java.util.ArrayList;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import cn.ilikes.modules.HbaseIndex;
import cn.ilikes.tools.hbase.jpa.annotations.IndexColumn;
import cn.ilikes.tools.hbase.jpa.annotations.IndexColumn.Index;


@Entity
@Table(name = "ilikes_folder", schema = HbaseIndex.ILIKES_SCHEMA)
@cn.ilikes.tools.hbase.jpa.annotations.Index
public class IlikesFolder {

	@Id
	private String uuid;

	@Column(name = "folder@name")
	@IndexColumn(index = Index.analyzed)
	private String folderName;

	@OneToMany( fetch = FetchType.LAZY, mappedBy = "parents")
	private List<IlikesFolder> childs = new ArrayList<IlikesFolder>();

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "folder@parents")
	@IndexColumn
	private IlikesFolder parents;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user@login_name")
	@IndexColumn
	private IlikesUser likesUser;
	
	@OneToMany( fetch = FetchType.LAZY, mappedBy = "likesFolder")
	private List<IlikesContent> likesContents = new ArrayList<IlikesContent>();

	

	public String getUuid() {
		return uuid;
	}

	public String getFolderName() {
		return folderName;
	}

	public List<IlikesFolder> getChilds() {
		return childs;
	}

	public IlikesFolder getParents() {
		return parents;
	}

	public IlikesUser getLikesUser() {
		return likesUser;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public void setFolderName(String folderName) {
		this.folderName = folderName;
	}

	public void setChilds(List<IlikesFolder> childs) {
		this.childs = childs;
	}

	public void setParents(IlikesFolder parents) {
		this.parents = parents;
	}

	public void setLikesUser(IlikesUser likesUser) {
		this.likesUser = likesUser;
	}

	public List<IlikesContent> getLikesContents() {
		return likesContents;
	}

	public void setLikesContents(List<IlikesContent> likesContents) {
		this.likesContents = likesContents;
	}

}
